package com.yss.pojo.response;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ResponseMessage<T> {

    private T message;
    private int code;

    public static <T> ResponseMessage success(T body) {
        return ResponseMessage.builder().code(0).message(body).build();
    }

    public static <T> ResponseMessage error(T body, int errCode) {
        return ResponseMessage.builder().code(errCode).message(body).build();
    }

}
